package com.whmskj.xjlhsc.qianYiData.controller;

import com.whmskj.xjlhsc.qianYiData.dto.ProcessRunStatsSyncResult;
import com.whmskj.xjlhsc.qianYiData.service.ProcessRunStatsService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/qianYiData/processStats")
@RequiredArgsConstructor
public class ProcessRunStatsController {

    private final ProcessRunStatsService service;

    /**
     * 手动同步工序开停台与开台率（POST），返回详细变更日志
     * 用法：POST /qianYiData/processStats/sync
     */
    @PostMapping("/sync")
    public ProcessRunStatsSyncResult syncPost() {
        return service.syncWithLogs();
    }

    /**
     * 手动同步工序开停台与开台率（GET 兼容），返回详细变更日志
     * 用法：GET /qianYiData/processStats/sync
     */
    @GetMapping("/sync")
    public ProcessRunStatsSyncResult syncGet() {
        return service.syncWithLogs();
    }
}

